package com.fesine.ch02.innerTest1;

/**
 * @description: 类描述
 * @author: Fesine
 * @createTime:2016/7/7 10:44
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/7/7 10:44
 */
public class OutClass {
    static class InnerClass {
        public void method() {
            synchronized ("其他的锁") {
                for (int i = 0; i < 11; i++) {
                    System.out.println(Thread.currentThread().getName() + ",i=" + i);
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }

        public synchronized void method2() {
            for (int i = 11; i < 21; i++) {
                System.out.println(Thread.currentThread().getName() + ",i=" + i);
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
